
package datos;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import conexion.ConexionBD;

public class ActualizacionCliente {

	protected ConexionBD conect = new ConexionBD();
	ResultSet res;
	PreparedStatement pstm;
	
	public void crearCliente(String id, String name, String tel, String direc) throws SQLException{
		pstm = conect.getConexion().prepareStatement(
				"INSERT INTO cliente VALUES (" +
				"'"+id+"', " +
				"'"+name+"', " +
				"'"+tel+"', " +
				"'"+direc+"');");
		pstm.executeUpdate();
	}
	
	public void eliminarCliente(String id) throws SQLException{
			pstm = conect.getConexion().prepareStatement(
					"DELETE FROM cliente WHERE idcliente = '"+id+"';");
			pstm.executeUpdate();
			
		}
		
	public void actualizarCliente(String[] cliente) throws SQLException{ 
        pstm = conect.getConexion().prepareStatement( 
                "UPDATE cliente" + 
                " SET idcliente='"+cliente[0]+"'," + 
                " nombre='"+cliente[1]+"'," + 
                " telefono='"+cliente[2]+"'," + 
                " direccion='"+cliente[3]+"'" + 
                " WHERE idcliente='"+cliente[0]+"';");  
        pstm.executeUpdate(); 
    } 
      



	}
	



